package thread.ThreadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolExecutor {
    public static void main(String[] args) {
        ExecutorService pool = Executors.newCachedThreadPool();
        pool.submit(new Runnable() {
            @Override
            public void run() {
                for(int i = 0; i < 10; i++) {
                    System.out.println("线程:" + Thread.currentThread().getName() + "完成任务:" + i);
                }
            }
        });
        pool.submit(new Runnable() {
            @Override
            public void run() {
                for(int i = 0; i < 10; i++) {
                    System.out.println("线程:" + Thread.currentThread().getName() + "完成任务:" + i);
                }
            }
        });
    }
}
